<template>
  <div id="main">
    <!-- 顶部标题 -->
    <div class="title-infomation">
      <h2>{{ ShowTitle }}</h2>
    </div>
    <!-- 功能区 -->
    <div class="table-allinfomation">
      <div id="table-info">

        <!-- 条件搜索（必须有） -->
        <div class="search-info">
          <div class="table-button-info"><el-button v-if="routerInfo.routerType=== 1" type="success" @click="attendanceAdmin()">考勤管理</el-button></div>
          <div class="table-form-info">
            <el-form v-model="searchUserInfo" :inline="true" class="search-infomation">
              <el-form-item label="根据姓名查询信息">
                <el-input
                  v-model="searchUserInfo"
                  clearable
                  maxlength="5"
                  show-word-limit
                  placeholder="请输入姓名"
                />
              </el-form-item>
              <el-form-item>
                <el-button type="primary" @click="searchUserInfomation">查询</el-button>
                <el-button plain @click="cleanSearchUserInfomation">重置</el-button>
              </el-form-item>
            </el-form>
          </div>
          <!-- 文件导出 -->
          <div>
            <el-button v-if="routerInfo.routerType === 3" type="primary" style="margin-left:1rem" @click="updown">文件导出</el-button>
          </div>

        </div>
        <!-- 表单展示 -->
        <el-table
          ref="userInfoTable"
          v-loading="loading"
          :data="showAllUserInfo.slice((currentPage-1)*pagesize,currentPage*pagesize)"
          stripe
          fit
          highlight-current-row
          class="table-infomation"
          :default-sort="{prop: 'sendScore', order: 'ascending'}"
          @selection-change="selectAllSend"
        >
          <el-table-column
            id="isShowSelectButton"
            type="selection"
            min-width="5%"
          />
          <el-table-column
            label="序号"
            type="index"
            min-width="12%"
            align="center"
          >
            <template slot-scope="scope">
              <span>{{ (currentPage - 1) * pagesize + scope.$index + 1 }}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="userId"
            label="用户工号"
            sortable
            :sort-orders="sortOrders"
            min-width="12%"
          />
          <el-table-column
            align="center"
            prop="userName"
            label="用户姓名"
            min-width="12%"
          />
          <el-table-column
            align="center"
            prop="userBranch"
            label="所属党小组"
            min-width="12%"
            :filters="userAllBranch"
            filter-multiple
            column-key="userBranch"
            :filter-method="selectUserBranch"
          />
          <el-table-column
            v-if=" routerInfo.routerType===3"
            align="center"
            label="当前审核状态"
            min-width="12%"
            :filters="sendAllStatus"
            filter-multiple
            column-key="sendStatus"
            :filter-method="selectSendStatus"
          >
            <template slot-scope="scope">
              <el-tag v-if="scope.row.send.sendStatus === 0">未审核</el-tag>
              <el-tag v-if="scope.row.send.sendStatus === 1" type="success">已通过</el-tag>
              <el-tag v-if="scope.row.send.sendStatus !== 1 && scope.row.send.sendStatus !== 2 && scope.row.send.sendStatus !== 0 || scope.row.send.sendStatus === 3" type="warning">未提交</el-tag>
              <el-tag v-if="scope.row.send.sendStatus === 2" type="danger">未通过</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            v-if="routerInfo.routerType=== 5"
            align="center"
            label="当前状态"
            min-width="12%"
          >
            <template v-if="routerInfo.routerType=== 5" slot-scope="scope">
              <el-tag v-if="scope.row.send.sendScore === ''||scope.row.send.sendScore === null || scope.row.send.sendScore === undefined || scope.row.send.sendScore > -300">非一票否决</el-tag>
              <el-tag v-if="scope.row.send.sendScore < -300" type="danger">一票否决</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            v-if="routerInfo.routerType!== 5"
            align="center"
            label="分数"
            prop="send.sendScore"
            min-width="12%"
            sortable
            :sort-orders="sortOrders"
            :filters="sendAllScore"
            filter-multiple
            column-key="sendScore"
            :filter-method="selectSendStore"
          >
            <template v-if="routerInfo.routerType!== 5" slot-scope="scope">
              <el-tag v-if="scope.row.send.sendScore === ''||scope.row.send.sendScore === null || scope.row.send.sendScore === undefined ">未评分</el-tag>
              <div v-if="scope.row.send.sendScore !== ''">{{ scope.row.send.sendScore }}</div>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            label="详情"
            min-width="20%"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-button v-if=" routerInfo.routerType===3" type="text" size="small" @click="examineSend(scope.row.userId,scope.row.send.sendId,scope.row.send.sendStatus)"><p style="color:#2ecc71">审核</p></el-button>
              <el-button v-if="routerInfo.routerType=== 1 || routerInfo.routerType=== 2 || routerInfo.routerType===3" type="text" size="small" @click="scoreSend(scope.row.userId,scope.row.send.sendId,scope.row.send.sendStatus)">评分</el-button>
              <el-button v-if="routerInfo.routerType=== 5" type="text" size="small"><p style="color:#e74c3c" @click="VetoSend(scope.row.userId,scope.row.send.sendId)">一票否决</p></el-button>
              <el-button v-if="scope.row.send.review.reviewId !== null" type="text" size="small" @click="reviewSend(scope.row.userId,scope.row.send.sendId,scope.row.send.sendStatus,scope.row.send.review.reviewId,scope.row.send.review.reviewStatus)"><p style="color:#9b59b6">复核</p></el-button>
              <el-button type="text" size="small" @click="showRemarkInfo(scope.row.userId,scope.row.send.sendId)"><p style="color:#f39c12">备注</p></el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 下方内容 -->
        <el-row class="bottom-all-info">
          <!-- 功能区 -->
          <el-col :span="12">
            <div>
              <!-- 批量审核 -->
              <el-dropdown v-if="routerInfo.routerType === 3" placement="bottom-start" split-button type="primary" @command="showSelectAllExamine" @click="showSelectAllExamine('a')">
                批量审核
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item command="b">选中未审核的全部信息</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
              <!-- 批量赋分 -->
              <el-button v-if="routerInfo.routerType !== 5" style="margin-left:1rem" type="primary" @click="batchScore()">批量评分</el-button>
              <!--  -->
            </div>
          </el-col>
          <el-col :span="12">
            <!-- 分页功能 -->
            <div id="pages" class="paging-info">
              <el-pagination
                :current-page="currentPage"
                :page-sizes="[5,10,15,20,30,50]"
                :page-size="pagesize"
                layout="total , sizes , prev , pager , next"
                :total="userInfo.length"
                prev-text="上一页"
                next-text="下一页"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
              />
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import { searchUserInfomations } from '../../api/public.js'
import { getFlist } from '../../api/flist.js'
import { getSlist } from '../../api/slist.js'
import { getTlist } from '../../api/tlist.js'
import { getAllRanking } from '../../api/public.js'
import { isOpenSendTime } from '../../utils/isOpenSendTime.js'
import { findNowSemester } from '../../api/semester.js'
import { getZipBySemNameAndRouterName } from '../../api/flie.js'
import { getGroups } from '../../api/branch.js'
export default {
  props: {
    // 路由信息获取
    routerMessage: {
      type: Object,
      default: () => {}
    }
  },
  inject: ['reload'],
  data() {
    return {
      // 获取全部数据存储位置

      userInfo: [],
      originUserInfo: [],
      routerInfo: [],
      routerAllId: [],
      ShowTitle: '',
      // 展示的值
      showAllUserInfo: [],
      // 代码数据存储位置
      loading: true,
      userInfoSend: '0',
      currentPage: 1, // 默认显示页面为1
      pagesize: 20, // 每页的数据条数
      userAllBranch: [],
      sendAllStatus: [
        {
          text: '未审核',
          value: 0
        },
        {
          text: '已通过',
          value: 1
        },
        {
          text: '未通过',
          value: 2
        },
        {
          text: '未提交',
          value: 3
        }
      ],
      sendAllScore: [
        {
          text: '未评分',
          value: 1
        },
        {
          text: '已评分',
          value: 2
        }
      ],
      sortOrders: [
        'ascending', 'descending'
      ],
      // 搜索设置中转值和最后值
      searchUserInfo: '', // 中转值
      searchUserName: '', // 保存值
      nowTime: '', // 当前时间
      timeType: '', // 时间状态(1.在开放学期内2.还未到开放时间3.已过开放时间)
      nowSemName: ''// 学期名称
    }
  },
  computed: {
  },
  watch: {
  },
  created() {
    // 根据不同等级路由根据编号返回路由信息
    this.judgeRouterType(this.routerMessage.routerLevel, this.routerMessage.routerId)
    this.getSemesterInfo()
    // 获取所有党小组信息
    this.getAllBranch()
  },
  methods: {
    // 全部调用方法

    // 根据不同等级路由根据编号返回路由信息
    judgeRouterType(routerLevel, routerId) {
      var that = this
      var nowSemId = sessionStorage.getItem('semId')
      if (nowSemId === '无开放学期') {
        // 提示默认展示第一学期
        this.$alert('当前无开放学期，无法评分。系统将跳转到学期管理页面', '提示', {
          confirmButtonText: '确定',
          callback: action => {
            that.$router.push({ path: that.redirect || '/systemManage/semesterAdmin' })
          }
        })
      } else {
        new Promise(function(resolve, reject) {
          switch (routerLevel) {
            case 1:
              new Promise(function(resolve, reject) {
                getFlist(routerId).then((res) => {
                  resolve(res.obj)
                })
              }).then((data) => {
                that.routerInfo = data
                this.$message({
                  message: '当前访问位置为顶级路由',
                  type: 'warning'
                })
              })
              resolve()
              break
            case 2:
              new Promise(function(resolve, reject) {
                getSlist(routerId).then((res) => {
                  resolve(res.obj)
                })
              }).then((data) => {
                // 保存通用数据
                that.routerInfo.routerId = data.slistId
                that.routerInfo.routerName = data.slistName
                that.routerInfo.routerUpId = data.slistFlistId
                that.routerInfo.routerUserType = data.slistUserType
                that.routerInfo.routerInfo = data.slistInfo
                that.routerInfo.routerPath = data.slistPath
                that.routerInfo.routerComponent = data.slistComponent
                that.routerInfo.routerStatus = data.slistStatus
                // 2评分制 3评分审核值 5一票否决制
                that.routerInfo.routerType = data.slistType
                that.routerInfo.routerBaseScore = data.slistBaseScore
                that.routerInfo.routerMaxScore = data.slistMaxScore
                that.routerInfo.routerMinScore = data.slistMinScore
                that.routerInfo.routerScoreType = data.slistScoreType
                that.routerInfo.routerIconWeb = data.slistIconWeb
              }).then(() => {
              // 保存路由顶级路由id和当前路由id
                that.routerInfo.routerTopId = that.routerInfo.routerUpId
                that.routerAllId.slist = routerId
                sessionStorage.setItem('flist', that.routerInfo.routerTopId)
                sessionStorage.setItem('slist', that.routerInfo.routerId)
                sessionStorage.setItem('tlist', 'nolook')
                resolve()
              })

              break
            case 3:
              new Promise(function(resolve, reject) {
                getTlist(routerId).then((res) => {
                  resolve(res.obj)
                })
              }).then((data) => {
                // 保存通用数据
                // 已知三级路由id和二级路由id -> 一级路由id -> 存到session里面
                that.routerInfo.routerId = data.tlistId
                that.routerInfo.routerName = data.tlistName
                that.routerInfo.routerUpId = data.tlistSlistId
                that.routerInfo.routerUserType = data.tlistUserType
                that.routerInfo.routerInfo = data.tlistInfo
                that.routerInfo.routerPath = data.tlistPath
                that.routerInfo.routerComponent = data.tlistComponent
                that.routerInfo.routerStatus = data.tlistStatus
                that.routerInfo.routerType = data.tlistType
                that.routerInfo.routerBaseScore = data.tlistBaseScore
                that.routerInfo.routerMaxScore = data.tlistMaxScore
                that.routerInfo.routerMinScore = data.tlistMinScore
                that.routerInfo.routerScoreType = data.tlistScoreType
                that.routerInfo.routerIconWeb = data.tlistIconWeb
                // 保存三级路由和二级路由id
                that.routerAllId.slist = data.tlistSlistId
                that.routerAllId.tlist = routerId
              }).then(() => [
              // 根据二级路由id获取一级路由
                new Promise(function(resolve, reject) {
                  getSlist(that.routerInfo.routerUpId).then((res) => {
                    resolve(res.obj)
                  })
                }).then((data) => {
                  that.routerInfo.routerTopId = data.slistFlistId
                  sessionStorage.setItem('flist', that.routerInfo.routerTopId)
                  sessionStorage.setItem('slist', that.routerAllId.slist)
                  sessionStorage.setItem('tlist', that.routerAllId.tlist)
                  resolve()
                })
              ])
              break
            default:
              that.$message.error('路由信息获取失败')
              break
          }
        }).then(() => {
          that.getAllUserInfo()
        })
      }
    },

    // 获取所有用户信息
    getAllUserInfo() {
      var that = this
      new Promise(function(resolve, reject) {
        var flist = sessionStorage.getItem('flist')
        var slist = sessionStorage.getItem('slist')
        var tlist = sessionStorage.getItem('tlist')
        var sendSemseterId = sessionStorage.getItem('semId')

        getAllRanking(flist, slist, tlist, sendSemseterId).then((res) => {
          // 保存userInfo中的信息
          that.userInfo = res.obj.send
          resolve(res)
        })
      }).then((res) => {
        that.showAll()
      })
    },

    // 全部信息展示
    showAll() {
      var that = this
      // 判断是否为审核状态，动态调整css
      if (that.routerInfo.routerType === 5) {
        var obj = document.getElementById('pages')
        obj.style.cssText = 'float:left'
        that.$refs.userInfoTable.doLayout()
      }
      this.showAllUserInfo = that.userInfo
      this.showRouterName = this.routerInfo.routerName
      this.ShowTitle = this.routerInfo.routerInfo
      this.loading = false
    },
    // 审核
    examineSend(userId, sendId, sendStatus) {
      var that = this
      // 看下是否在开放时间内
      isOpenSendTime().then((res) => {
        that.timeType = res
        if (that.timeType === 1) {
          if (sendStatus !== 0 && sendStatus !== 1 && sendStatus !== 2) {
            that.$message({
              message: '该用户未提交信息，暂不能审核',
              type: 'warning'
            })
          } else {
            if (sendId === undefined) {
            // 添加send表
              const getStatus = []
              getStatus.userId = userId
              getStatus.sendId = 'none'
              getStatus.onclickType = 1
              that.$emit('getStatus', getStatus)
            } else {
            // 修改send表
              const getStatus = []
              getStatus.userId = userId
              getStatus.sendId = sendId
              getStatus.onclickType = 1
              that.$emit('getStatus', getStatus)
            }
          }
        } else if (that.timeType === 2) {
          that.$message({
            message: '未到开放时间',
            type: 'warning'
          })
        } else if (that.timeType === 3) {
          that.$message({
            message: '已过开放时间',
            type: 'warning'
          })
        } else {
          that.$message({
            message: '系统繁忙请联系管理员',
            type: 'warning'
          })
        }
      })
    },
    // 评分
    scoreSend(userId, sendId, sendStatus) {
      var that = this
      var routerType = that.routerInfo.routerType
      // 看下是否在开放时间内
      isOpenSendTime().then((res) => {
        that.timeType = res
        if (that.timeType === 1) {
        // 看下是否为审核评分制
          if (routerType === 3) {
            if (sendStatus === null) {
              that.$message({
                message: '该用户未提交信息，暂不能评分',
                type: 'warning'
              })
            } else {
              if (sendStatus === 0) {
                that.$message({
                  message: '请您先审核，再评分',
                  type: 'warning'
                })
              } else {
                // 修改send表
                const getStatus = []
                getStatus.userId = userId
                getStatus.sendId = sendId
                getStatus.onclickType = 2
                that.$emit('getStatus', getStatus)
              }
            }
            // 仅评分制
          } else {
            if (sendId === undefined) {
            // 添加send表
              const getStatus = []
              getStatus.userId = userId
              getStatus.sendId = 'none'
              getStatus.onclickType = 2
              that.$emit('getStatus', getStatus)
            } else {
            // 修改send表
              const getStatus = []
              getStatus.userId = userId
              getStatus.sendId = sendId
              getStatus.onclickType = 2
              that.$emit('getStatus', getStatus)
            }
          }
        } else if (that.timeType === 2) {
          that.$message({
            message: '未到开放时间',
            type: 'warning'
          })
        } else if (that.timeType === 3) {
          that.$message({
            message: '已过开放时间',
            type: 'warning'
          })
        } else {
          that.$message({
            message: '系统繁忙请联系管理员',
            type: 'warning'
          })
        }
      })
    },
    // 一票否决
    VetoSend(userId, sendId) {
      var that = this
      // 看下是否在开放时间内
      isOpenSendTime().then((res) => {
        that.timeType = res
        if (that.timeType === 1) {
          that.$confirm('您将使用一票否决制功能，请慎重使用。如一票否决，会导致该用户总成绩为0分。', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            if (sendId === null) {
            // 添加send表
              const getStatus = []
              getStatus.userId = userId
              getStatus.sendId = 'none'
              getStatus.onclickType = 3
              that.$emit('getStatus', getStatus)
            } else {
            // 修改send表
              const getStatus = []
              getStatus.userId = userId
              getStatus.sendId = sendId
              getStatus.onclickType = 3
              that.$emit('getStatus', getStatus)
            }
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消使用'
            })
          })
        } else if (that.timeType === 2) {
          that.$message({
            message: '未到开放时间',
            type: 'warning'
          })
        } else if (that.timeType === 3) {
          that.$message({
            message: '已过开放时间',
            type: 'warning'
          })
        } else {
          that.$message({
            message: '系统繁忙请联系管理员',
            type: 'warning'
          })
        }
      })
    },
    // 备注
    showRemarkInfo(userId, sendId) {
      var that = this
      if (sendId === null) {
        // 添加send表
        const getStatus = []
        getStatus.userId = userId
        getStatus.sendId = 'none'
        getStatus.onclickType = 7
        that.$emit('getStatus', getStatus)
      } else {
        // 修改send表
        const getStatus = []
        getStatus.userId = userId
        getStatus.sendId = sendId
        getStatus.onclickType = 7
        that.$emit('getStatus', getStatus)
      }
    },
    // 复核
    reviewSend(userId, sendId, sendStatus, reviewId, reviewStatus) {
      var that = this
      // 看下是否在开放时间内
      isOpenSendTime().then((res) => {
        that.timeType = res
        if (that.timeType === 1) {
          // 传值给父组件
          const getStatus = []
          getStatus.userId = userId
          getStatus.sendId = sendId
          getStatus.reviewId = reviewId
          getStatus.reviewStatus = reviewStatus
          getStatus.onclickType = 4
          that.$emit('getStatus', getStatus)
        } else if (that.timeType === 2) {
          that.$message({
            message: '未到开放时间',
            type: 'warning'
          })
        } else if (that.timeType === 3) {
          that.$message({
            message: '已过开放时间',
            type: 'warning'
          })
        } else {
          that.$message({
            message: '系统繁忙请联系管理员',
            type: 'warning'
          })
        }
      })
    },
    // 查看考勤管理信息
    attendanceAdmin() {
      const that = this
      // 看下是否在开放时间内
      isOpenSendTime().then((res) => {
        that.timeType = res
        if (that.timeType === 1) {
          // 保存考勤管理信息
          const getStatus = []
          getStatus.sendInfo = that.showAllUserInfo
          getStatus.checkList = JSON.parse(sessionStorage.getItem('routerMessage')).routerLevel
          getStatus.checkListId = that.routerInfo.routerId
          getStatus.routerInfo = that.routerInfo
          getStatus.onclickType = 8
          that.$emit('getStatus', getStatus)
        } else if (that.timeType === 2) {
          that.$message({
            message: '未到开放时间',
            type: 'warning'
          })
        } else if (that.timeType === 3) {
          that.$message({
            message: '已过开放时间',
            type: 'warning'
          })
        } else {
          that.$message({
            message: '系统繁忙请联系管理员',
            type: 'warning'
          })
        }
      })
    },
    // 获取学期名称
    getSemesterInfo() {
      var that = this
      var semId = sessionStorage.getItem('semId')
      if (semId !== '无开放学期') {
        findNowSemester().then((res) => {
          that.nowSemName = res.obj.semName
        })
      }
    },
    // 搜索页面信息
    searchUserInfomation() {
      var that = this
      var searchUserInfo = this.searchUserInfo
      var nowSemId = sessionStorage.getItem('semId')
      if (nowSemId !== '无开放学期') {
        if (that.searchUserInfoStatus !== 1) {
          that.originUserInfo = that.userInfo
        }
        new Promise(function(resolve, reject) {
          searchUserInfomations(searchUserInfo).then(res => {
            resolve(res.obj.send)
          })
        }).then((data) => {
          if (data.length !== 0) {
            var giveUserInfo = []
            that.searchUserInfoStatus = 1
            new Promise(function(resolve, reject) {
              if (that.searchUserInfoStatus !== 1) {
                for (let i = 0; i < data.length; i++) {
                  var newUserInfo = that.userInfo.filter(function(val) {
                    return val.userId === data[i].userId
                  })
                  giveUserInfo.push(newUserInfo[0])
                  resolve(giveUserInfo)
                }
              } else {
                for (let j = 0; j < data.length; j++) {
                  var newUserInfo1 = that.originUserInfo.filter(function(val) {
                    return val.userId === data[j].userId
                  })
                  giveUserInfo.push(newUserInfo1[0])
                  resolve(giveUserInfo)
                }
              }
            }).then((data) => {
              that.userInfo = data
              that.showAll()
            })
          } else if (data.length === 0) {
            this.$message({
              type: 'warning',
              message: '未搜索到数据'
            })
          } else {
            this.$message({
              type: 'warning',
              message: '服务器异常，请稍后再试'
            })
          }
        })
      }
    },
    // 文件导出
    updown() {
      var that = this
      getZipBySemNameAndRouterName(that.nowSemName, that.showRouterName).then(res => {
        if (res.result === true) {
          window.location.href = res.msg
          this.$message({
            type: 'success',
            message: '文件下载成功'
          })
        } else if (res.result === false) {
          this.$message({
            type: 'warning',
            message: res.msg
          })
        } else {
          this.$message({
            type: 'warning',
            message: '系统繁忙请联系管理员'
          })
        }
      })
    },
    // 获取所有党小组信息
    getAllBranch() {
      var that = this
      getGroups().then((res) => {
        this.allBranch = res.obj
        for (let i = 0; i < res.obj.length; i++) {
          const branch = {
            value: res.obj[i].branchName,
            text: res.obj[i].branchName
          }
          that.userAllBranch.push(branch)
        }
      })
    },
    // 页面逻辑方法
    handleClose() {
      this.dialogFormVisible = false
      this.is_show_judge = false
      this.send = []
      this.list = []
      this.fetchData()
    },
    // 选择党小组
    selectUserBranch(value, row, column) {
      return row.userBranch === value
    },
    // 选择状态
    selectSendStatus(value, row, column) {
      if (value === 3 && row.sendStatus !== 0 && row.sendStatus !== 1 && row.sendStatus !== 2) {
        return row.sendStatus !== value
      } else {
        return row.sendStatus === value
      }
    },
    // 选择分数
    selectSendStore(value, row, column) {
      if (value === 1 && row.sendScore === undefined) {
        return row.sendScore !== value
      } else if (value === 2 && row.sendScore !== undefined) {
        var sendScore = row.sendScore
        return row.sendScore === sendScore
      }
    },
    // 清空全部筛选
    cleanSearchUserInfomation() {
      var that = this
      this.$message({
        message: '重置成功',
        type: 'success'
      })
      if (that.originUserInfo.length !== 0) {
        that.userInfo = that.originUserInfo
      }
      this.searchUserInfo = ''
      this.$refs.userInfoTable.clearFilter()
      that.searchUserInfomation()
    },
    // 存储选中的信息
    selectAllSend(send) {
      this.userInfoTable = send
    },
    // 展示批量审核中的内容
    showSelectAllExamine(data) {
      var that = this
      var semId = sessionStorage.getItem('semId')
      // 看下是否在开放时间内
      if (semId !== '无开放学期') {
        isOpenSendTime().then((res) => {
          that.timeType = res
          if (that.timeType === 1) {
            if (data === 'a') {
            // 判断当前是否有选中数据
              if (that.userInfoTable === undefined || that.userInfoTable.length === 0) {
                that.$message({
                  message: '请您选择数据后再提交',
                  type: 'warning'
                })
              } else {
              // 条件判断
                var isSelectScore = 0
                new Promise(function(resolve, reject) {
                  for (let i = 0; i < that.userInfoTable.length; i++) {
                    if (that.userInfoTable[i].send.sendStatus === null) {
                    // 当前有未提交的数据
                      isSelectScore = 1
                      resolve()
                      break
                    }
                    if (i === that.userInfoTable.length - 1) {
                      resolve()
                    }
                  }
                }).then(() => {
                  if (isSelectScore === 1) {
                    that.$message({
                      message: '当前选中选项中有未提交的数据，禁止审核',
                      type: 'warning'
                    })
                  } else {
                    const getStatus = []
                    getStatus.allSend = that.userInfoTable
                    getStatus.onclickType = 5
                    that.$emit('getStatus', getStatus)
                  }
                })
              }
            } else if (data === 'b') {
            // 选中未审核的全部信息
              that.$refs.userInfoTable.clearSelection()
              var userInfo = that.showAllUserInfo
              var sendSelect = []
              for (let j = 0; j < userInfo.length; j++) {
                if (userInfo[j].send.sendStatus === 0) {
                  sendSelect.push(userInfo[j])
                }
              }
              sendSelect.forEach(row => {
                that.$refs.userInfoTable.toggleRowSelection(row)
              })
            }
          } else if (that.timeType === 2) {
            that.$message({
              message: '未到开放时间',
              type: 'warning'
            })
          } else if (that.timeType === 3) {
            that.$message({
              message: '已过开放时间',
              type: 'warning'
            })
          } else {
            that.$message({
              message: '系统繁忙请联系管理员',
              type: 'warning'
            })
          }
        })
      }
    },
    // 批量评分
    batchScore() {
      var that = this// 判断当前是否有选中数据
      // 看下是否在开放时间内
      isOpenSendTime().then((res) => {
        that.timeType = res
        if (that.timeType === 1) {
          if (that.userInfoTable === undefined || that.userInfoTable.length === 0) {
            that.$message({
              message: '请您选择数据后再提交',
              type: 'warning'
            })
          } else {
            // 判断当前类型
            if (that.routerInfo.routerType === 3) {
              // 审核评分制
              var isSelectScore = 0
              new Promise(function(resolve, reject) {
                for (let i = 0; i < that.userInfoTable.length; i++) {
                  if (that.userInfoTable[i].send.sendStatus === null || that.userInfoTable[i].send.sendStatus === 0) {
                    // 当前有未审核或者未提交的数据
                    isSelectScore = 1
                    resolve()
                    break
                  } else if (that.userInfoTable[i].send.sendStatus === 2 && that.userInfoTable[i].send.sendStatus !== 0 && that.userInfoTable[i].send.sendStatus === null) {
                    isSelectScore = 2
                    resolve()
                    break
                  }
                  if (i === that.userInfoTable.length - 1) {
                    resolve()
                  }
                }
              }).then(() => {
                if (isSelectScore === 1) {
                  that.$message({
                    message: '当前选中选项中有未审核的数据，禁止评分',
                    type: 'warning'
                  })
                } else {
                  const getStatus = []
                  getStatus.allSend = that.userInfoTable
                  getStatus.onclickType = 6
                  that.$emit('getStatus', getStatus)
                }
              })
            } else if (that.routerInfo.routerType === 2 || that.routerInfo.routerType === 1) {
              // 仅评分制
              const getStatus = []
              getStatus.allSend = that.userInfoTable
              getStatus.onclickType = 6
              that.$emit('getStatus', getStatus)
            }
          }
        } else if (that.timeType === 2) {
          that.$message({
            message: '未到开放时间',
            type: 'warning'
          })
        } else if (that.timeType === 3) {
          that.$message({
            message: '已过开放时间',
            type: 'warning'
          })
        } else {
          that.$message({
            message: '系统繁忙请联系管理员',
            type: 'warning'
          })
        }
      })
    },

    // 分页
    handleSizeChange(size) {
      this.pagesize = size
    },
    // 点击第几页
    handleCurrentChange(currentPage) {
      this.currentPage = currentPage
    }

  }
}
</script>

<style scope>
#main{
  margin-left: 5px;
  margin-right: 5px;
  margin-bottom: 10rem;
}
#table-area{
  margin-left: 0.8rem;
  margin-right: 0.8rem;
}
.title-infomation{
  margin-top:3rem;
  margin-left: 4rem;
  margin-bottom: 3rem;
}
.table-info{
  margin-left: 7rem;
  margin-right: 10rem;
}
.table-infomation{
  width: 100rem;
}
.bottom-all-info{
  margin-top: 2rem;
}
.paging-info{
  float: right;
}
.search-info{
  margin-bottom: 1.5rem;
}
.table-allinfomation{
  margin-left: 5rem;
  margin-right: 5rem;
}
.table-button-info{
  float: left;
}
.table-form-info{
  float: right;
}
</style>
